home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Frameworks / MacZoop 1.6.5 / Basic Classes / Z Sources / ZErrors.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-25  |  936 b   |  74 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************************
  2. *
  3. *
  4. *            ObjectMacZapp        -- a standard Mac OOP application template
  5. *
  6. *
  7. *
  8. *            ZErrors.cpp            -- utils for throwing exceptions
  9. *
  10. *
  11. *
  12. *
  13. *
  14. *            © 1996, Graham Cox
  15. *
  16. *
  17. *
  18. *
  19. *************************************************************************************************/
  20.  
  21.  
  22. #include    "ZErrors.h"
  23. #include    "ZDefines.h"
  24.  
  25.  
  26. void    FailNIL( void* aPtr )
  27. {
  28.     if ( aPtr == NULL )
  29.         FailOSErr( memFullErr );
  30. }
  31.  
  32.  
  33. void    FailOSErr( OSErr theErr )
  34. {
  35.     if ( theErr != noErr )
  36.         throw theErr;
  37. }
  38.  
  39.  
  40. void    Fail()
  41. {
  42.     FailOSErr( kUnknownExceptionErr );
  43. }
  44.  
  45.  
  46.  
  47. void    FailNILRes( void* aResPtr )
  48. {
  49.     if ( aResPtr == NULL )
  50.         FailOSErr( resNotFound );
  51. }
  52.  
  53.  
  54.  
  55. void    FailSilent()
  56. {
  57.     FailOSErr( kSilentErr );
  58. }
  59.  
  60.  
  61.  
  62. void    FailParamErr( OSErr theErr )
  63. {
  64.     if ( theErr != noErr )
  65.         FailOSErr( paramErr );
  66. }
  67.  
  68.  
  69.  
  70. void    FailNILParam( void* aPtr )
  71. {
  72.     if ( aPtr == NULL )
  73.         FailOSErr( paramErr );
  74. }